import Mock from 'mockjs2'
import { builder, builderQueryResponse } from '../util'

const getApprovals = () => {
  var datas = []
  var count = 100
  for (let i = 1; i <= count; i++) {
    datas.push({
      id: i,
      createtime: 'city',
      hospitalName: '武汉医院' + i,
      staffCount: i * (Math.round(Math.random() * 1000) % 10),
      address: 'address' + i
    })
  }
  return builderQueryResponse(datas)
}

const GetHospitalByID = (id) => {
  return builder({
    id: 1,
    createtime: 'city',
    hospitalName: '武汉医院',
    staffCount: 1 * (Math.round(Math.random() * 1000) % 10),
    address: 'address'
  })
}

Mock.mock(/\/questionnaires$/, 'get', getApprovals)
// Mock.mock(/\/hospitals$/, 'post', createHospital)
Mock.mock(/\/questionnaires\/[1-9][0-9]*$/, 'get', GetHospitalByID)
// Mock.mock(/\/hospitals\/[1-9][0-9]*$/, 'delete', deleteHospital)
